Skip to content

fix(antigravity-ls-proxy): bound language-server RPCs with timeouts (#2102) - #4080

Merged
dezren39 merged 3 commits into
mainfrom
queue/5092-2102-bound-antigravity-ls-proxy-rpcs
Nov 3, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/5092-2102-bound-antigravity-ls-proxy-rpcs

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #2102 (task 5092).

Change

bin/antigravity-ls-proxy.mjs — callRpc no longer fetches the language server unbounded:

  • Method-specific budgets applied via one AbortSignal.timeout that covers both the fetch and the response-body read: GetAvailableModels 3000ms, StartCascade 30000ms, SendUserCascadeMessage 30000ms, GetCascadeTrajectorySteps 5000ms, GetModelResponse 300000ms (long generations keep their minutes); default 30000ms for any other method. A timeout throws RPC <method> timed out after <budget>ms.
  • Cascade polling now obeys a strict 30000ms elapsed-time deadline (Date.now() based) instead of the old 120-iteration count that slow polls could stretch far past 30s.
  • Bounded failure modes: a stalled catalog RPC makes /v1/models fall back to the static/cached catalog (existing getLiveCatalog behavior, now actually reachable in bounded time); stalled chat RPCs surface as a clean API error from the existing chat error handler — nothing hangs indefinitely.
  • Test injection: budgets are overridable via ANTIGRAVITY_LS_RPC_TIMEOUTS (JSON method→ms) and the cascade deadline via ANTIGRAVITY_LS_CASCADE_DEADLINE_MS, so tests use ~200ms budgets instead of waiting minutes.

Heartbeat and sync-models timeouts were already bounded and are untouched; design-code-proxy (#2097) and clef-proxy (#2100) are out of scope.

Tests

node --test bin/antigravity-ls-proxy.test.mjs — 18/18 pass (13 existing + 5 new):

  • hung GetAvailableModels → /v1/models still serves the static catalog, bounded
  • hung GetModelResponse → clean bounded API error naming the timeout
  • slow-but-alive RPC (100ms delay, 2000ms budget) → succeeds
  • cascade polling stops at the injected 600ms elapsed deadline
  • healthy cascade still completes

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 23:56
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0223c682-8573-448e-89b4-31a23414e4fd
Commits

Reviewing files that changed from the base of the PR and between 1e3763f and c3adadb.

Files selected for processing: 2
  • bin/antigravity-ls-proxy.mjs
  • bin/antigravity-ls-proxy.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T11:01:41.978372Z
We couldn’t complete this review. Comment @codex review to try again.
c3adadb New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3afde72a9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/antigravity-ls-proxy.mjs Outdated
Comment on lines 890 to 892
while (completedResponse === null && Date.now() < cascadeDeadline) {
await new Promise(r => setTimeout(r, 250));
const trajectory = await lsManager.callRpc('GetCascadeTrajectorySteps', { cascadeId });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the remaining cascade deadline to each poll

When a trajectory poll starts near the deadline, the subsequent sleep and RPC are not constrained by the remaining time, and a completed response is accepted even after the deadline expires. With production defaults, this can overrun the advertised 30-second polling limit by the sleep, heartbeat, and full 5-second RPC budget. I reproduced HTTP 200 after approximately 1.3 seconds with a 100ms cascade deadline and a 1000ms trajectory delay. Bound the sleep and in-flight poll by the remaining cascade budget, and check expiration before accepting the result.

Useful? React with 👍 / 👎.

…proxy-rpcs

# Conflicts:
#	bin/antigravity-ls-proxy.test.mjs
…eadline (#2102)

Codex P2 on PR #4080: a poll starting near the deadline could sleep a
full 250ms, run a full 5s RPC, and have its late response accepted,
overrunning the 30s cascade deadline. The sleep and the poll RPC are
now capped at the remaining budget (callRpc gains an optional cap that
can only shrink the per-method budget), a poll that hits the cap reads
as the deadline expiring, and a response landing after the deadline is
discarded. Regression test mirrors the Codex repro (100ms deadline,
1000ms trajectory delay): the request now ends at the deadline with
the cascade timeout error instead of HTTP 200 after ~1.3s.
node --test bin/antigravity-ls-proxy.test.mjs: 20/20 pass on laptop.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39
dezren39 merged commit 0090459 into main Nov 3, 2026
1 check passed
@dezren39
dezren39 deleted the queue/5092-2102-bound-antigravity-ls-proxy-rpcs branch November 3, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant